﻿using System;
using System.Collections;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Pibby.Core;

namespace Pibby.Controls
{
	public class ListViewDateSubItem : ListViewItem.ListViewSubItem
	{
		private readonly DateTime _date;

		public ListViewDateSubItem(DateTime d)
			: base()
		{
			this._date = d;

			if (this._date == DateTime.MinValue)
				this.Text = string.Empty;
			else
				this.Text = HumanReadableDateInterpreter.HowLongAgo(this._date);
		}

		public DateTime Date
		{
			get
			{
				return _date;
			}
		}

		public static int Compare(ListViewDateSubItem first, ListViewDateSubItem second)
		{
			return DateTime.Compare(first.Date, second.Date);
		}

	}

}
